package org.linlinjava.litemall.db.domain;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public class AgedmallShopWebPageDetail {

    private Integer id;

    private Integer shopId;

    private String title;

    private String remark;

    private LocalDateTime addTime;

    private LocalDateTime updateTime;

    private String url;

    private String html;

    private String seoDescription;

    private String seoKeywords;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public LocalDateTime getAddTime() {
        return addTime;
    }

    public void setAddTime(LocalDateTime addTime) {
        this.addTime = addTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getHtml() {
        return html;
    }

    public void setHtml(String html) {
        this.html = html;
    }

    public String getSeoDescription() {
        return seoDescription;
    }

    public void setSeoDescription(String seoDescription) {
        this.seoDescription = seoDescription;
    }

    public String getSeoKeywords() {
        return seoKeywords;
    }

    public void setSeoKeywords(String seoKeywords) {
        this.seoKeywords = seoKeywords;
    }

    public static AgedmallShopWebPageDetail parseObject(AgedmallShopWebPage shopWebPage,String domain) {
        AgedmallShopWebPageDetail pageSimple = new AgedmallShopWebPageDetail();
        pageSimple.setId(shopWebPage.getId());
        pageSimple.setShopId(shopWebPage.getId());
        pageSimple.setSeoDescription(shopWebPage.getSeoDescription());
        pageSimple.setSeoKeywords(shopWebPage.getSeoKeywords());
        pageSimple.setHtml(shopWebPage.getHtml());
        pageSimple.setTitle(shopWebPage.getTitle());
        pageSimple.setRemark(shopWebPage.getRemark());
        pageSimple.setAddTime(shopWebPage.getAddTime());
        pageSimple.setUpdateTime(shopWebPage.getUpdateTime());
        pageSimple.setUrl(String.format("%s/shop/webpage/view/pid/%d/key/%s", domain, shopWebPage.getId(), shopWebPage.getKey()));
        return pageSimple;
    }

    public static List<AgedmallShopWebPageDetail> parseList(List<AgedmallShopWebPage> shopWebPageList,String domain) {
        List<AgedmallShopWebPageDetail> pageSimpleList = new ArrayList<AgedmallShopWebPageDetail>();
        if (shopWebPageList != null && shopWebPageList.size() > 0) {
            for (AgedmallShopWebPage shopWebPage: shopWebPageList) {
                pageSimpleList.add(parseObject(shopWebPage,domain));
            }
        }
        return pageSimpleList;
    }

}
